package com.haidechizi.i18n.code.generator.common.propconvert.generator;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author wangdejun
 * @create 2020/10/17 9:45
 */
public class PropGeneratorFactory {

    private static final Map<String, PropGenerator> generatorHolder = new ConcurrentHashMap<>(8);


    /**
     * 将generator添加到容器中
     *
     * @param name          名称
     * @param propGenerator 实现类
     */
    public static final void addGenerator(String name, PropGenerator propGenerator) {
        generatorHolder.put(name, propGenerator);
    }


    /**
     * 获取generator
     *
     * @param name 名称
     * @return
     */
    public static final PropGenerator getGenerator(String name) {
        return generatorHolder.get(name);
    }
}
